home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / popupre / modchild.frm < prev    next >
Text File  |  1995-03-03  |  3KB  |  122 lines

  1. VERSION 2.00
  2. Begin Form frmModalChild 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Modal Child"
  6.    ClientHeight    =   975
  7.    ClientLeft      =   3330
  8.    ClientTop       =   4605
  9.    ClientWidth     =   3315
  10.    Height          =   1380
  11.    Left            =   3270
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   975
  15.    ScaleWidth      =   3315
  16.    Top             =   4260
  17.    Width           =   3435
  18.    Begin CommandButton cmdClose 
  19.       Cancel          =   -1  'True
  20.       Caption         =   "Close"
  21.       Default         =   -1  'True
  22.       Height          =   345
  23.       Left            =   1335
  24.       TabIndex        =   0
  25.       Top             =   315
  26.       Width           =   1485
  27.    End
  28.    Begin Image imgButtonUp 
  29.       Height          =   330
  30.       Left            =   2865
  31.       Picture         =   MODCHILD.FRX:0000
  32.       Top             =   15
  33.       Visible         =   0   'False
  34.       Width           =   360
  35.    End
  36.    Begin Image imgButtonDown 
  37.       Height          =   330
  38.       Left            =   2865
  39.       Picture         =   MODCHILD.FRX:0182
  40.       Top             =   345
  41.       Visible         =   0   'False
  42.       Width           =   360
  43.    End
  44.    Begin Image imgPopUp 
  45.       Height          =   330
  46.       Left            =   450
  47.       Top             =   345
  48.       Width           =   360
  49.    End
  50.    Begin Label lblMenuClick 
  51.       BackColor       =   &H000000FF&
  52.       ForeColor       =   &H000000FF&
  53.       Height          =   225
  54.       Left            =   2910
  55.       TabIndex        =   1
  56.       Top             =   735
  57.       Visible         =   0   'False
  58.       Width           =   285
  59.    End
  60. End
  61. Option Explicit
  62.  
  63. Sub cmdClose_Click ()
  64.  
  65.     ' Unload the form when 'Close' is pressed
  66.     Unload Me
  67.  
  68. End Sub
  69.  
  70. Sub Form_Load ()
  71.  
  72.     ' Show 'button up' image initially
  73.     imgPopUp = imgButtonUp
  74.  
  75. End Sub
  76.  
  77. Sub HandleMyPopUp (P_nIndex As Integer)
  78. ' This sub would handle the clicks on the menu entries of the
  79. ' child popup menu received by lblMenuClick from frmMenuContainer
  80.     
  81.     Select Case P_nIndex
  82.  
  83.     Case 0:
  84.  
  85.     Case 1:
  86.     
  87.     Case 2:
  88.     
  89.     Case 3:
  90.     
  91.     End Select
  92.  
  93. End Sub
  94.  
  95. Sub imgPopUp_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  96.  
  97.     ' Show 'button down' image
  98.     imgPopUp = imgButtonDown
  99.  
  100.     ' !!! THIS POPUPMENU METHOD DOES NOT INVOKE THE CHILD POPUP MENU
  101.     ' BECAUSE OF THE NON-REENTRANCY OF THE MENU CONTAINER WINDOW CODE !!!
  102.     PopupMenu frmMenuContainer.mnuPopUpChild, 0
  103.  
  104.     ' Show 'button up' image
  105.     imgPopUp = imgButtonUp
  106.  
  107. End Sub
  108.  
  109. Sub lblMenuClick_Change ()
  110. ' The 'Change' event of this label is triggered when a click on
  111. ' a menu entry in frmMenuContainer sets the label caption with the
  112. ' related menu entry index
  113.     
  114.     ' Handle the menu click if an index is available
  115.     If lblMenuClick <> "" Then HandleMyPopUp Val(lblMenuClick)
  116.  
  117.     ' Reset the label for new menu entry clicks
  118.     lblMenuClick = ""
  119.  
  120. End Sub
  121.  
  122.